﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Web;
using System.Web.UI;
using System.Web.UI.WebControls;
using Smart.UI.BaseClasses;

namespace Smart
{
    public partial class SiteMaster : System.Web.UI.MasterPage
    {
        protected void Page_Load(object sender, EventArgs e)
        {
            // TODO: Check if we need this
            if (!Page.IsPostBack)
            {
                // Check if current user is Authenticated
                if (!Page.User.Identity.IsAuthenticated && Page is AuthenticatedPage)
                {
                    string returnUrl = Server.UrlEncode(Request.Url.PathAndQuery);
                    Response.Redirect(String.Format("~/Account/Login.aspx?returnUrl={0}", returnUrl));
                }
            }
        }
    }
}
